Skip to content

feat(actions): setup-rust-toolchain-from-file#1

Open
jgeluk wants to merge 1 commit into
mainfrom
feat/setup-rust-toolchain-from-file
Open

feat(actions): setup-rust-toolchain-from-file#1
jgeluk wants to merge 1 commit into
mainfrom
feat/setup-rust-toolchain-from-file

Conversation

@jgeluk

@jgeluk jgeluk commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New composite action `setup-rust-toolchain-from-file` that reads the channel from `rust-toolchain.toml` and installs the toolchain, optionally adding the Swatinem rust-cache.
  • Every Rust CI job otherwise repeats ~30 lines of boilerplate per job: sed-parse the channel from `rust-toolchain.toml`, call `actions-rust-lang/setup-rust-toolchain`, optionally call `Swatinem/rust-cache`. That boilerplate has no single source of truth and drifts independently across jobs. This action makes it one `uses:` line.

Inputs

  • `path` (default `rust-toolchain.toml`) — path to the rust-toolchain file.
  • `components` (default empty) — comma-separated rustup components passed through.
  • `cache` (default `true`) — opt out for lint-only / fmt-only jobs that don't compile.
  • `cache-shared-key` — `shared-key` passed to `Swatinem/rust-cache`.

Output

  • `toolchain` — the channel resolved from the file (e.g. `nightly-2025-08-29`).

Failure modes

  • Missing file → `::error file=::rust-toolchain file not found`.
  • No `channel` line → `::error file=::no channel = "..." line found`.

Test plan

  • action.yml YAML is well-formed.
  • Indexed under "Setup Actions" in `.github/actions/README.md`.
  • README documents usage, inputs, outputs, failure modes, and motivation with side-by-side before/after.
  • First consumer will be a follow-up PR in `dataroadinc/wwkg` that deletes ~250 lines of duplicated boilerplate across 8 Rust jobs in `.github/workflows/build.yml`.

🤖 Generated with Claude Code

Add a composite action that reads the channel from rust-toolchain.toml
and installs the toolchain, optionally followed by Swatinem/rust-cache.

Every Rust CI job otherwise repeats ~30 lines of boilerplate (sed-parse
the channel, call setup-rust-toolchain, call rust-cache) that have no
single source of truth and drift independently across jobs. This action
collapses that into one uses: line per job, with optional inputs for
components, the cache shared-key, and a cache opt-out for lint-only
jobs.

Inputs:
- path             default rust-toolchain.toml
- components       comma-separated rustup components (passed verbatim)
- cache            "true" (default) or "false" to skip rust-cache
- cache-shared-key shared-key passed to Swatinem/rust-cache

Output:
- toolchain        the resolved channel (e.g. nightly-2025-08-29)

Includes a README documenting usage, inputs, outputs, failure modes,
and the motivation. Indexed under "Setup Actions" in the actions README.
@cocogitto-bot

cocogitto-bot Bot commented May 28, 2026

Copy link
Copy Markdown

✔️ 208ba05 - Conventional commits check succeeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant